package ch05.test1;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestUser {
    @Test
    public void test(){
        //实例化Spring的上下文
        ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationch05test.xml");

        //通过getBean方法根据id获取ben的实例
        User user= (User) ctx.getBean("user");

        //执行输出方法
        user.print();
        user.print1();
    }
}
